summaryrefslogtreecommitdiffstats
path: root/src/video_core/renderer_vulkan/vk_state_tracker.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/renderer_vulkan/vk_state_tracker.cpp')
-rw-r--r--src/video_core/renderer_vulkan/vk_state_tracker.cpp58
1 files changed, 36 insertions, 22 deletions
diff --git a/src/video_core/renderer_vulkan/vk_state_tracker.cpp b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
index edb41b171..339679ff9 100644
--- a/src/video_core/renderer_vulkan/vk_state_tracker.cpp
+++ b/src/video_core/renderer_vulkan/vk_state_tracker.cpp
@@ -27,10 +27,27 @@ using Flags = Maxwell3D::DirtyState::Flags;
Flags MakeInvalidationFlags() {
static constexpr int INVALIDATION_FLAGS[]{
- Viewports, Scissors, DepthBias, BlendConstants, DepthBounds,
- StencilProperties, LineWidth, CullMode, DepthBoundsEnable, DepthTestEnable,
- DepthWriteEnable, DepthCompareOp, FrontFace, StencilOp, StencilTestEnable,
- VertexBuffers, VertexInput,
+ Viewports,
+ Scissors,
+ DepthBias,
+ BlendConstants,
+ DepthBounds,
+ StencilProperties,
+ LineWidth,
+ CullMode,
+ DepthBoundsEnable,
+ DepthTestEnable,
+ DepthWriteEnable,
+ DepthCompareOp,
+ FrontFace,
+ StencilOp,
+ StencilTestEnable,
+ VertexBuffers,
+ VertexInput,
+ StateEnable,
+ PrimitiveRestartEnable,
+ RasterizerDiscardEnable,
+ DepthBiasEnable,
};
Flags flags{};
for (const int flag : INVALIDATION_FLAGS) {
@@ -96,16 +113,20 @@ void SetupDirtyCullMode(Tables& tables) {
table[OFF(gl_cull_test_enabled)] = CullMode;
}
-void SetupDirtyDepthBoundsEnable(Tables& tables) {
- tables[0][OFF(depth_bounds_enable)] = DepthBoundsEnable;
-}
-
-void SetupDirtyDepthTestEnable(Tables& tables) {
- tables[0][OFF(depth_test_enable)] = DepthTestEnable;
-}
-
-void SetupDirtyDepthWriteEnable(Tables& tables) {
- tables[0][OFF(depth_write_enabled)] = DepthWriteEnable;
+void SetupDirtyStateEnable(Tables& tables) {
+ const auto setup = [&](size_t position, u8 flag) {
+ tables[0][position] = flag;
+ tables[1][position] = StateEnable;
+ };
+ setup(OFF(depth_bounds_enable), DepthBoundsEnable);
+ setup(OFF(depth_test_enable), DepthTestEnable);
+ setup(OFF(depth_write_enabled), DepthWriteEnable);
+ setup(OFF(stencil_enable), StencilTestEnable);
+ setup(OFF(primitive_restart.enabled), PrimitiveRestartEnable);
+ setup(OFF(rasterize_enable), RasterizerDiscardEnable);
+ setup(OFF(polygon_offset_point_enable), DepthBiasEnable);
+ setup(OFF(polygon_offset_line_enable), DepthBiasEnable);
+ setup(OFF(polygon_offset_fill_enable), DepthBiasEnable);
}
void SetupDirtyDepthCompareOp(Tables& tables) {
@@ -133,10 +154,6 @@ void SetupDirtyStencilOp(Tables& tables) {
tables[1][OFF(stencil_two_side_enable)] = StencilOp;
}
-void SetupDirtyStencilTestEnable(Tables& tables) {
- tables[0][OFF(stencil_enable)] = StencilTestEnable;
-}
-
void SetupDirtyBlending(Tables& tables) {
tables[0][OFF(color_mask_common)] = Blending;
tables[0][OFF(blend_per_target_enabled)] = Blending;
@@ -185,13 +202,10 @@ void StateTracker::SetupTables(Tegra::Control::ChannelState& channel_state) {
SetupDirtyStencilProperties(tables);
SetupDirtyLineWidth(tables);
SetupDirtyCullMode(tables);
- SetupDirtyDepthBoundsEnable(tables);
- SetupDirtyDepthTestEnable(tables);
- SetupDirtyDepthWriteEnable(tables);
+ SetupDirtyStateEnable(tables);
SetupDirtyDepthCompareOp(tables);
SetupDirtyFrontFace(tables);
SetupDirtyStencilOp(tables);
- SetupDirtyStencilTestEnable(tables);
SetupDirtyBlending(tables);
SetupDirtyViewportSwizzles(tables);
SetupDirtyVertexAttributes(tables);